/* 采购合同管理 */
// 导入axios实例
import httpRequest from '@/utils/requestmcg'

// 分页
export function fetchListPurchase(query: object) {
  return httpRequest({
    url: '/getAll/contract',
    method: 'post',
    data: query
  })
}

// 新增采购合同
export function apiAddPurchase(obj: object) {
  return httpRequest({
    url: 'add/contract',
    method: 'post',
    data: obj
  })
}

// 编辑采购合同--回显
export function apiGetPurchase(id: string) {
  return httpRequest({
    url: '/getOne/contract/' + id,
    method: 'get',
  })
}
// 编辑采购合同
export function apiPutPurchase(obj: object) {
  return httpRequest({
    url: '/update/contract',
    method: 'put',
    data: obj
  })
}

// 删除采购合同
export function apiDeletePurchase(id: string) {
  return httpRequest({
    url: '/delete/contract/' + id,
    method: 'delete',
  })
}

// 搜索采购合同
export function apiSearchPurchase(obj: object) {
  return httpRequest({
    url: '/fuzzySearch/contract',
    method: 'post',
    data: obj
  })
}



// 查询所有子公司名称
export function apiGetCompany() {
  return httpRequest({
    url: '/getAll/company',
    method: 'get',
  })
}

// 查询所有物料类型名称
export function fetchListMaterielType(query: object) {
  return httpRequest({
    url: '/getAll/materielType',
    method: 'post',
    data: query
  })
}

// 导出
export function apiexportPurchase() {
  return httpRequest({
    url: '/export/contract',
    method: 'post',
  })
}